set nocompatible
"source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin

"cd $VIMRUNTIME/tags

set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let eq = ''
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      let cmd = '""' . $VIMRUNTIME . '\diff"'
      let eq = '"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction

":colo pablo  
:colo myColor

" An example for a vimrc file.
"
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	2008 Jul 02
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"	      for Amiga:  s:.vimrc
"  for MS-DOS and Win32:  $VIM\_vimrc
"	    for OpenVMS:  sys$login:.vimrc

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

if has("vms")
  set nobackup		" do not keep a backup file, use versions instead
else
  set nobackup		" keep a backup file
endif
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching
set nowrapscan

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Don't use Ex mode, use Q for formatting
"map Q gq
"map W 0"*y$  
"map EE <C-V>

" CTRL-U in insert mode deletes a lot.  Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>

" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
  set mouse=a
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

" Only do this part when compiled with support for autocommands.
if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  "filetype plugin indent on
  filetype plugin indent on

  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
  au!

  " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  " Also don't do it when the mark is in the first line, that is the default
  " position when opening a file.
  autocmd BufReadPost *
    \ if line("'\"") > 1 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif

  augroup END
else

  set autoindent		" always set autoindenting on

endif " has("autocmd")

" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
  command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
		  \ | wincmd p | diffthis
endif

set expandtab
set tabstop=4
set shiftwidth=4
set number
set ignorecase
set foldmethod=marker


set go=e
"color lettuce  
"color myColor  
color bandit

"set Taglist option
let Tlist_Exit_OnlyWindow = 1 "Close Vim if the taglist is the only window.
let Tlist_Show_One_File	= 1	  "Show tags for the current buffer only.

"map to change the split window size
map <C-h> <C-W>h
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-l> <C-W>l
map <A-j> <C-W>+
map <A-k> <C-W>-
map <A-h> <C-W><
map <A-l> <C-W>>

"map the key to change Tab
map 1<CR> 1gt
map 2<CR> 2gt
map 3<CR> 3gt
map 4<CR> 4gt
map 5<CR> 5gt
map 6<CR> 6gt
map 7<CR> 7gt
map 8<CR> 8gt
map 9<CR> 9gt

"map the key to half page up/down
map <A-d> <C-d>
noremap <A-u> <C-u>

"map the key to line up/down
noremap J j<C-e>h 
noremap K k<C-y>h 

"map the key for copy and paste in different file
map <S-y> "*y
map <S-p> "*p

"map the key for Up/Low case change
"map .. ~

"map the write command in insert mode
imap :w <Esc>:w<CR>

"mat ctrl-v as past in command 
cmap <C-V>		<C-R>+

"set lookupfile option
let g:LookupFile_MinPatLength = 3               "最少输入3个字符才开始查找
let g:LookupFile_PreserveLastPattern = 0        "不保存上次查找的字符串

if filereadable($VIMRUNTIME."/tags/filenametags")                "设置tag文件的名字
let g:LookupFile_TagExpr = '$VIMRUNTIME."/tags/filenametags"'
endif
"F6调用TAG 查找 
nnoremap <silent> <C-F6> :LUTags<CR>
"F7调用Walk查找
nnoremap <silent> <C-F7> :LUWalk<CR>




"关于cscope的设置
set csprg=D:\ProgramFiles\cscope\cscope\cscope
"set csprg=D:\Work\Tools\cygwin\bin\cscope
cs add D:\Temp\code\cscope.out D:\Temp\code      "设置database位置
cs add D:\Work\View\Zengj_view_Infiniti\Novanto\cscope.out D:\Work\View\Zengj_view_Infiniti\Novanto
cs add D:\SorceCode\SVN\cscope.out  D:\SorceCode\SVN     "设置database位置
cs add D:\SorceCode\linux\cscope.out   D:\SorceCode\linux    "设置database位置
set cscopequickfix=s-,c-,d-,i-,t-,e-
noremap <C-n> :cn<CR>
noremap <C-p> :cp<CR>
"map the hot key
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>

" Using 'CTRL-spacebar' then a search type makes the vim window
" split horizontally, with search result displayed in
" the new window.

nmap <S-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <S-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <S-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <S-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <S-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <S-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <S-Space>i :scs find i <C-R>=expand("<cfile>")<CR><CR>
nmap <S-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>

map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>


nmap <F7> :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <F8> <C-]>
nmap <A-Space> :Tlist<CR>

"set filetype=python
"au BufNewFile,BufRead *.py,*.pyw setf python
